const fs = require('fs');
const execa = require('execa');

async function build(target) {
  // 执行命令rollup -c --environment TARGET:shared
  const env = 'development';
  await execa(
    'rollup',
    [
      '-cw',
      '--environment',
      [
        `TARGET:${target}`,
        `NODE_ENV:${env}`,
      ].filter(Boolean).join(',')
    ],
    { stdio: 'inherit' }
  )
}

// const target = 'reactivity';
// const target = 'runtime-dom';
const target = 'compiler-dom';
build(target);
